package Thread.choujiang;

import java.util.ArrayList;
import java.util.Collections;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

public class Test {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        ArrayList<Integer> list = new ArrayList<>();
        Collections.addAll(list,800,60,34,234,54,13,43,23,65,345,322);
        Callable c1 = new MyCallAble(list);

        FutureTask<Integer> futureTask1= new FutureTask<>(c1);
        FutureTask<Integer> futureTask2= new FutureTask<>(c1);

        Thread t1 = new Thread(futureTask1);
        Thread t2 = new Thread(futureTask2);


        t1.start();
        t2.start();


        Integer i1 = futureTask1.get();
        Integer i2 = futureTask1.get();


        System.out.println(i1);
        System.out.println(i2);
    }
}
